@import "reset";

/* fonts */

$body-fonts: Arial, Verdana, sans-serif;
$monospace-fonts: monospace;

/* colors */

$body-bg-color: rgb(247, 247, 247);
$body-color: rgb(0, 0, 0);

$box-border-color: rgb(211, 211, 211);
$box-bg-color: rgb(241, 241, 241);

$button-bg-color: rgb(3, 25, 79);
$button-color: rgb(255, 255, 255);
$button-border-color: rgb(192, 192, 192);

$code-color: rgb(0, 96, 0);
$code-bg-color: rgb(239, 239, 239);

$del-bg-color: rgb(244, 204, 204);
$ins-bg-color: rgb(217, 234, 211);

$heading-color: rgb(0, 0, 0);

$main-bg-color: rgb(255, 255, 255);
$main-border-color: $box-border-color;

$license-color: rgb(94, 106, 114);
$license-bg-color: rgb(255, 255, 255);

$link-color: rgb(0, 102, 204);
$link-color-heading: $link-color;
$link-color-heading-em: rgb(0, 102, 204); // TODO: Figure out if this is used?
$link-disabled-color: rgb(102, 102, 102); // TODO: Figure out if this is used?
$link-visited-color: rgb(71, 18, 100);

$selector-bg-color: rgb(90, 112, 166);

$sidebar-section-bg-color: rgb(255, 255, 255);
$sidebar-section-color: rgb(72, 72, 72);
$sidebar-section-selected-color: black;

$table-border-color: rgb(217, 217, 217);

/* page-wide settings */

a {
  color: $link-color;
  &.disabled {
    color: $link-disabled-color;
    text-decoration: none;
  }
}

b {
  font-weight: 700;
}

body {
  background-color: $body-bg-color;
  color: $body-color;
  font-family: $body-fonts;
}

code {
  background: $code-bg-color;
  color: $code-color;
  font-family: $monospace-fonts;
}

em,
i {
  font-style: italic;
}

pre {
  background: $code-bg-color;
  border: 1px solid $box-border-color;
  margin: 1em;
  padding: 0.5em 1em 0.5em 1em;
}

header {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin: 5px 5px 5px 10px;

  a {
    align-items: center;
    color: $link-color-heading;
    display: flex;
    text-decoration: none;

    h2 {
      width: 100%;
    }
  }

  img {
    display: block;
    margin-right: 10px;
  }
}

/* main panel */

#main-wrapper {
  display: flex;
}


#sidebar-left {
  flex: 0 auto;
  font-size: 12px;
  line-height: 1.33em;
  min-width: 160px;
  width: 160px;

  section {
    background-color: $sidebar-section-bg-color;
    margin: 0 5px 6px 5px;
    padding: 0 0 0 5px;
  }

  a {
    color: $link-color;
    display: block;
    text-decoration: none;

    &.selected {
      color: $sidebar-section-selected-color;
      font-weight: bold;
    }
  }

  h4 {
    color: $sidebar-section-color;
    font-weight: 700;
    font-size: 13px;
    margin-bottom: 1px;
    padding: 3px 0 2px 0;
  }

  #license {
    background-color: $license-bg-color;
    color: $license-color;
    font-size: 10px;
    line-height: normal;
    margin: 0 5px 6px 5px;
    padding: 11px 5px 5px 5px;

    a {
      display: inline;
      text-decoration: underline;
    }
  }

  // Explicitly use the `a` tag to override the specificity of `#sidebar a`.
  a#edit-this-page {
    background-color: $button-bg-color;
    border: 1px solid $button-border-color;
    color: $button-color;
    display: block;
    font-size: 14px;
    font-weight: 700;
    margin: 20px auto;
    padding: 6px 12px;
    text-align: center;
    text-decoration: none;
    width: 90%;
  }
}

main {
  background-color: $main-bg-color;
  border: 1px solid $main-border-color;
  flex: 1 100%;
  font-family: $body-fonts;
  font-size: 13.333px;
  line-height: 1.3;
  margin-right: 5px;
  padding: 20px;

  a:visited {
    color: $link-visited-color;
  }

  a.header-anchor {
    color: inherit;
    text-decoration: inherit;
  }

  blockquote {
    margin-bottom: 13.33px;
    margin-top: -12px;
  }

  del {
    background-color: $del-bg-color;
    text-decoration: inherit;
  }

  h1 {
    font-size: 22px;
    font-weight: 700;
    margin: 10px 0 1.4em;

    a {
      color: $link-color-heading;
    }
  }

  h2 {
    font-size: 20px;
    font-weight: 700;
    margin: 1.2em 0 .8em 0;
  }

  h3 {
    font-size: 16px;
    font-weight: 700;
    margin: 1.2em 0 .7em 0;
  }

  h4 {
    font-weight: 700;
    margin: 1.2em 0 .6em 0;

    a {
      color: $link-color-heading;
    }

    i a {
      color: $link-color-heading-em;
      font-weight: 400;
    }
  }

  ins {
    background-color: $ins-bg-color;
    text-decoration: inherit;
  }

  p {
    margin-bottom: 13.33px;
    margin-top: 1.4em;
  }

  pre {
    white-space: break-spaces;
    word-break: break-all;
  }

  #title-crumbs {
    padding: 6px 0 0 10px;

    + h3 {
      margin-top: 6px;
    }
  }

  ul {
    display: block;
    list-style-position: outside;
    list-style-type: disc;
    margin-bottom: 1em;
    margin-top: 1em;
    padding-left: 40px;

    li {
      margin-bottom: 5px;
      margin-top: 5px;

      > p:first-of-type {
        display: inline;
      }
    }

    ul {
      list-style-type: circle;
      margin-bottom: 0;
      margin-top: 0;

      ul {
        list-style-type: square;
      }
    }
  }

  ol {
    list-style-position: outside;
    list-style-type: decimal;
    padding-left: 40px;
    margin: 1em 0;

    li {
      margin: 5px 0;
      p {
        margin: .5em 0;
      }

      > p:first-of-type {
        display: inline;
      }
    }

    ul {
      list-style-type: circle;
      margin-bottom: 0;
      margin-top: 0;
    }
  }

  table {
    border-collapse: collapse;
    border-spacing: 0px;
    border-width: 1px solid $table-border-color;
    margin: 1.3em 0 1.3em 0;

    td,
    th {
      border: 1px solid $table-border-color;
      padding: 5px 10px 5px 10px;
      vertical-align: top;
    }
  }

  /* Rules for particular extensions */

  // Used by the `{% subpages collections.all %}` extension.
  nav.subpage-listing {
    background-color: $box-bg-color;
    border: 1px solid $box-border-color;

    details {
      margin-left: -1em;
    }

    h4 {
      margin: inherit;
      padding: 0.5em 0 0 0.5em;
    }

    li {
      font-weight: normal;
      list-style: none;
      list-style-image: none;
      margin-left: 1.2em;
      padding-left: 1.3em;

      a {
        text-decoration: none;
      }
    }

    ul {
      padding-left: 0px;
    }

    > ul {
      margin: 0.5em 0 0.5em 0;

      > li {
        border-top: 1px solid white;
        font-weight: bold;
        margin: 3px 0 3px 0;
        padding: 2px 0 2px 1.3em;
      }
    }
  }

  // Used by the `[TOC]` extension.
  .table-of-contents {
    border: 1px solid $box-border-color;
    background-color: $box-bg-color;
    display: table;
    font-size: 12px;
    margin-left: 1em;
    padding: 1em 2em 1em 1em;

    a {
      text-decoration: none;
    }

    > ol::before {
      content: "Contents";
      display: block;
      font-weight: 700;
      margin: 0 0 0.5em -1em;
    }

    ol {
      line-height: 1.1em;
      margin: 0;
      padding-left: 1.2em;

      li {
        list-style-type: none;
      }
    }
  }

  // Used for two-column content "extension".
  .two-column-container {
    align-items: flex-start;
    display: flex;

    > div.column {
      flex: 50%;
      margin: 0;
      padding-right: 30px;
    }
  }
}
